<?php

namespace app\index\validate;

use app\index\model\User;
use think\Validate;

class Question extends Validate
{
    protected $rule = [
    	'captcha'=>'require|captcha',
    	'kiss'  =>  'require|number|checkkiss',
        'title'  =>  'require|min:10|max:30',
        'content'  =>  'require|min:10',
        'cid'  =>  'require|number'
    ];

    protected $message  =   [
         
    ];

    public function checkkiss($value,$rule,$data)
    {
    	$user = User::get(session('user')->user_id);

    	if($user->kiss<$value){
    		return "飞吻不够，请先充值";
    	}else{
    		return true;
    	}
    }

}
